package br.edu.sistemaacademico;

import java.awt.ScrollPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

abstract class FrmModelo extends javax.swing.JDialog {

   public FrmModelo(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    }
   	
   public JScrollPane getScroll(){
	   return this.jScrollPane1;
   }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPmenu = new javax.swing.JPanel();
        jBtnGravar = new javax.swing.JButton();
        jBtnAlterar = new javax.swing.JButton();
        jBtnExcluir = new javax.swing.JButton();
        jBtnVoltar = new javax.swing.JButton();
        JbtnExtra1 = new javax.swing.JButton();
        JbtnExtra2 = new javax.swing.JButton();
        JbtnExtra3 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTtabela = new javax.swing.JTable();
        jTfBuscar = new javax.swing.JTextField();
        jBtnBuscar = new javax.swing.JButton();
        jMBmenu = new javax.swing.JMenuBar();
        jMenu2 = new javax.swing.JMenu();
        jMenu1 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setBounds(new java.awt.Rectangle(0, 0, 0, 0));
        setResizable(false);

        jPmenu.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jBtnGravar.setText("Novo");
        jBtnGravar.setName("novo"); // NOI18N
        jBtnGravar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnGravarActionPerformed(evt);
            }
        });

        jBtnAlterar.setText("Alterar");
        jBtnAlterar.setName("alterar"); // NOI18N
        jBtnAlterar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnAlterarActionPerformed(evt);
            }
        });

        jBtnExcluir.setText("Excluir");
        jBtnExcluir.setName("excluir"); // NOI18N
        jBtnExcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnExcluirActionPerformed(evt);
            }
        });

        jBtnVoltar.setText("Voltar");
        jBtnVoltar.setName("voltar"); // NOI18N
        jBtnVoltar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnVoltarActionPerformed(evt);
            }
        });

        JbtnExtra1.setText("...");
        JbtnExtra1.setName("alterar"); // NOI18N
        JbtnExtra1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JbtnExtra1ActionPerformed(evt);
            }
        });

        JbtnExtra2.setText("...");
        JbtnExtra2.setName("alterar"); // NOI18N
        JbtnExtra2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JbtnExtra2ActionPerformed(evt);
            }
        });

        JbtnExtra3.setText("...");
        JbtnExtra3.setName("alterar"); // NOI18N
        JbtnExtra3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JbtnExtra3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPmenuLayout = new javax.swing.GroupLayout(jPmenu);
        jPmenu.setLayout(jPmenuLayout);
        jPmenuLayout.setHorizontalGroup(
            jPmenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPmenuLayout.createSequentialGroup()
                .addComponent(jBtnGravar, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jBtnAlterar, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jBtnExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(JbtnExtra1, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(JbtnExtra2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(JbtnExtra3, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
                .addComponent(jBtnVoltar))
        );
        jPmenuLayout.setVerticalGroup(
            jPmenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPmenuLayout.createSequentialGroup()
                .addGroup(jPmenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPmenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jBtnGravar, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE)
                        .addComponent(jBtnAlterar, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE))
                    .addGroup(jPmenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jBtnExcluir, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)
                        .addComponent(JbtnExtra1, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)
                        .addComponent(JbtnExtra2, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)
                        .addComponent(JbtnExtra3, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)
                        .addComponent(jBtnVoltar, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        jTtabela.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Title 1"
            }
        ));
        jTtabela.setName("tabela"); // NOI18N
        jScrollPane1.setViewportView(jTtabela);

        jBtnBuscar.setText("Atualizar");

        jMenu2.setText("Edit");
        jMBmenu.add(jMenu2);

        jMenu1.setText("File");
        jMBmenu.add(jMenu1);

        setJMenuBar(jMBmenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPmenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 767, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jTfBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(10, 10, 10)
                        .addComponent(jBtnBuscar)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPmenu, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBtnBuscar)
                    .addComponent(jTfBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE)
                .addContainerGap())
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-801)/2, (screenSize.height-550)/2, 801, 550);
    }// </editor-fold>//GEN-END:initComponents

    private void jBtnAlterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnAlterarActionPerformed

    }//GEN-LAST:event_jBtnAlterarActionPerformed

    private void jBtnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnExcluirActionPerformed

    }//GEN-LAST:event_jBtnExcluirActionPerformed

    private void jBtnGravarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnGravarActionPerformed
        //Observer(evt, "Gravar");
        //jBtnGravar.setActionCommand(getCommandAction("gravar"));
        //jBtnGravar.addActionListener(getAction());
        //setButtonAction(jBtnGravar, "gravar");
    }//GEN-LAST:event_jBtnGravarActionPerformed

    private void jBtnVoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnVoltarActionPerformed
       // setVisible(false);
       // return;
    }//GEN-LAST:event_jBtnVoltarActionPerformed

    private void JbtnExtra1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JbtnExtra1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_JbtnExtra1ActionPerformed

    private void JbtnExtra2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JbtnExtra2ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_JbtnExtra2ActionPerformed

    private void JbtnExtra3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JbtnExtra3ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_JbtnExtra3ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton JbtnExtra1;
    private javax.swing.JButton JbtnExtra2;
    private javax.swing.JButton JbtnExtra3;
    private javax.swing.JButton jBtnAlterar;
    private javax.swing.JButton jBtnBuscar;
    private javax.swing.JButton jBtnExcluir;
    private javax.swing.JButton jBtnGravar;
    private javax.swing.JButton jBtnVoltar;
    private javax.swing.JMenuBar jMBmenu;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JPanel jPmenu;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField jTfBuscar;
    private javax.swing.JTable jTtabela;
    // End of variables declaration//GEN-END:variables

   public JTable getJTable(){
       return this.jTtabela;
   }
   public void setNone(){
	   jScrollPane1.setVisible(false);
	   jTtabela.setVisible(false);
	   jTfBuscar.setVisible(false);
	   jBtnBuscar.setVisible(false);	   
   }
   
   public JButton getJbtnGravar(){
       return jBtnGravar;
   }

   public JButton getbtnBusca(){
       return jBtnBuscar;
   }
   public JTextField getTfBuscar(){
       return jTfBuscar;
   }
   
   public JButton getbtnAlterar(){
       return jBtnAlterar;
   }
   public JButton getbtnExcluir(){
       return jBtnExcluir;
   }
   public JButton getbtnVoltar(){
       return jBtnVoltar;
   }
   public JButton getbtn4(){
       return JbtnExtra1;
   }
   public JButton getbtn5(){
       return JbtnExtra2;
   }
   public JButton getbtn6(){
       return JbtnExtra3;
   }
   public void actionBuscar(){
		getbtnBusca().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				atualiza();
			}
		});
   }
   public abstract void atualiza();
}
